package com.gisocn.onemap.ui.popupwindow;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.View;
import android.widget.PopupWindow;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gisocn.onemap.interfaces.OnItemClickListener;
import com.gisocn.onemap.model.LayerInfoBean;
import com.gisocn.onemap.sgzx.R;
import com.gisocn.onemap.ui.adapter.QueryStatisticsPopupAdapter;
import java.util.ArrayList;

/* loaded from: classes2.dex */
public class SelectGroupLayerPopWindow extends PopupWindow {
    private Context context;
    private ArrayList<LayerInfoBean> list;
    private OnItemClickListener onItemClickListener = null;
    private int width;

    public SelectGroupLayerPopWindow(ArrayList<LayerInfoBean> arrayList, int i, Context context) {
        this.list = arrayList;
        this.width = i;
        this.context = context;
        initView();
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.onItemClickListener = onItemClickListener;
    }

    void initView() {
        View inflate = View.inflate(this.context, R.layout.popup_group_layer, null);
        setContentView(inflate);
        setWidth(this.width);
        setHeight(inflate.getHeight());
        setOutsideTouchable(true);
        setBackgroundDrawable(new BitmapDrawable());
        RecyclerView recyclerView = (RecyclerView) inflate.findViewById(R.id.recycle_popup_grouplayer);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.context);
        linearLayoutManager.setOrientation(1);
        recyclerView.setLayoutManager(linearLayoutManager);
        QueryStatisticsPopupAdapter queryStatisticsPopupAdapter = new QueryStatisticsPopupAdapter(this.list);
        recyclerView.setAdapter(queryStatisticsPopupAdapter);
        queryStatisticsPopupAdapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.popupwindow.SelectGroupLayerPopWindow.1
            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i, int i2) {
            }

            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i) {
                SelectGroupLayerPopWindow.this.dismiss();
                if (SelectGroupLayerPopWindow.this.onItemClickListener != null) {
                    SelectGroupLayerPopWindow.this.onItemClickListener.onItemClick(view, i);
                }
            }
        });
    }
}
